package net.malkuth.test;

import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;


/**
 * Created by 一些年华 on 2016/7/8.
 */
public class LoginActivity extends BaseNewActivity implements OnClickListener {
    private static final int REQUEST_CODE_SCAN = 0x0000;
    private Button login;
    private Button mRegister;
    private Button mForget;
    

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_register:
                startActivity(new Intent(this, RegisterActivity.class));
                break;
            case R.id.btn_forget_pwd:
                startActivity(new Intent(this, ForgetPwdActivity.class));
                break;
            case R.id.btn_login:
                Intent intent = new Intent(this, MainActivity.class);
                //                startActivityForResult(intent, REQUEST_CODE_SCAN);
                startActivity(intent);

                break;
        }
    }

    @Override
    public void setupView() {
        login = (Button) findViewById(R.id.btn_login);
        mRegister = (Button) findViewById(R.id.btn_register);
        mForget = (Button) findViewById(R.id.btn_forget_pwd);
        login.setOnClickListener(this);
        mRegister.setOnClickListener(this);
        mForget.setOnClickListener(this);
    }

    @Override
    public void setContent() {
        this.setContentView(R.layout.activity_login);
    }

    @Override
    public void setModel() {

    }

    @Override
    public boolean getIntentValue() {
        //默认永远返回true,如果需要判断Intent是否有值传过来，需要重写此方法
        return true;
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        // 扫描二维码/条码回传
        if (requestCode == REQUEST_CODE_SCAN && resultCode == RESULT_OK) {
            if (data != null) {

                /*String content = data.getStringExtra(DECODED_CONTENT_KEY);
                Bitmap bitmap = data.getParcelableExtra(DECODED_BITMAP_KEY);*/

                //                qrCoded.setText("解码结果： \n" + content);
                //                qrCodeImage.setImageBitmap(bitmap);
            }
        }
    }
}
